﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Text;
using System.Windows.Forms;

namespace IEQ_Superintendencia.User_Interface
{
    public partial class UICadPastPres : UserControl
    {
        public UICadPastPres()
        {
            InitializeComponent();
            preencheCbPastor();
        }

        public void cadPastPres(int _culto_id)
        {
            tbCultoId.Text = _culto_id.ToString();
        }

        protected void preencheCbPastor()
        {
            IEQ_Superintendencia.Services.Persistence.dsIEQSuper.PASTORDataTable dtPastor= new IEQ_Superintendencia.Services.Persistence.dsIEQSuper.PASTORDataTable();
            IEQ_Superintendencia.Services.Persistence.dsIEQSuperTableAdapters.PASTORTableAdapter dsPastor = new IEQ_Superintendencia.Services.Persistence.dsIEQSuperTableAdapters.PASTORTableAdapter();

            dtPastor = dsPastor.GetData();
            cbPastor.DataSource = dtPastor;
            cbPastor.DisplayMember = "PASTOR_NOME";
            cbPastor.ValueMember = "PASTOR_ID";
        }

        private void cULTO_PASTORES_PRESENTESBindingNavigatorSaveItem_Click(object sender, EventArgs e)
        {
            this.Validate();
            this.bsPastPres.EndEdit();
            this.tableAdapterManager.UpdateAll(this.dsIEQSuper);

        }

        private void btnAdicionar_Click(object sender, EventArgs e)
        {
            
        }

        private void btnNovoPastor_Click(object sender, EventArgs e)
        {
            FrmCadPastor _frmCadPastor = new FrmCadPastor();          
            _frmCadPastor.Activate();
            _frmCadPastor.Show();
            
        }

        private void cbPastor_SelectedIndexChanged(object sender, EventArgs e)
        {
            tbPastorID.Text = cbPastor.SelectedValue.ToString();
        }

        private void cbPastor_Click(object sender, EventArgs e)
        {
            preencheCbPastor();
        }


    }
}
